package org.example.mapper;

import org.apache.ibatis.annotations.Select;
import org.example.pojo.Catalog;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import java.util.List;

/**
* @author Xiri
* @description 针对表【catalog】的数据库操作Mapper
* @createDate 2025-10-29 09:32:36
* @Entity org.example.pojo.Catalog
*/
public interface CatalogMapper extends BaseMapper<Catalog> {
	
	@Select("with RECURSIVE a1 as\n" +
			"(\n" +
			"\tselect * from catalog as c1 where id = '1'\n" +
			"\tUNION ALL\n" +
			"\tselect c2.* from catalog as c2 INNER JOIN a1 on a1.id = c2.parent_id\n" +
			")\n" +
			"select * from a1")
	List<Catalog> getCatalogs();
}




